<?php
/**
 * @annotate 人才库类
 * @group   Admin/Company
 * @author   yachtxiao <fuck@fackyou.org>
 */
class TalentAction extends BaseAction {
	protected $aVerify = array(
		   	'index',
		   	'download_resume',
		  	);//需要验证的方法
	public function index(){
		$cid = $_SESSION['company']['cid'];
		$talent = D('Talent')->list_talent($cid);
		$menu = D('Company_menu')->select_menu();
		$this->assign('resume_num',$menu['resume_num']);
		$this->assign('talent',$talent);
		$this->display();
	}
	
	public function download_resume(){
		$menu = D('Company_menu')->select_menu();
		if($menu['resume_num'] == 0){
			$this->ajaxReturn('','下载失败',0);
		}else{
			$resume_id = $_REQUEST['resume_id'];
			$cid = $_SESSION['company']['cid'];
			$result = D('Talent')->download_resume($resume_id,$cid);
			$phone = D('Talent')->find_phone($resume_id);
			if($result && $phone){
				$result1 = D('Company_menu')->download_resume();
				if($result1){
				$this->ajaxReturn("电话：".$phone,'下载成功',1);
				}
			}else{
				$this->ajaxReturn('','下载失败',0);
			}
		}
		
	}
	public function getvoiceurl(){
		$mp3url = getvoice($_GET['voice']);
		header('Content-type: audio/mp3');  
		header('Content-Disposition: attachment; filename="'.rand(1000000,9999999).'.mp3"');  
		readfile($mp3url);  
	}
}
?>